package com.bjpowernode.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bjpowernode.model.Result;
import com.bjpowernode.domain.Houses;
import com.bjpowernode.service.HousesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@RestController
@Api(tags = "房屋搜索接口")
public class HouseController {
    @Resource
    private HousesService housesService;

    @GetMapping("search")
    @ApiOperation("分页搜索房屋信息")
    public Result<Page<Houses>> searchHouses(String city, String content,Integer page){
       Page<Houses> housesPage =  housesService.searchHouses(page,city,content);
        return Result.success("ok",housesPage);
    }

    @GetMapping("details")
    @ApiOperation("根据id查询房屋详情接口")
    public Result<Houses> getHouseDetails(Integer id) {
        Houses houses = housesService.getById(id);
        return Result.success("ok", houses);
    }



}
